]> git.r.bdr.sh - rbdr/super-polarity/blame - Super Polarity/GameScreen.cs
I have the worst commits ever.
[rbdr/super-polarity] / Super Polarity / GameScreen.cs
CommitLineData
74c15570
BB
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Graphics;
7using Microsoft.Xna.Framework.Input;
8
9namespace SuperPolarity
10{
11 class GameScreen : Screen
12 {
13 public GameScreen(SuperPolarity newGame) : base(newGame) {}
14
15 public override void Initialize()
16 {
17 InputController.RegisterEventForButton("changePolarity", Buttons.A);
18 InputController.RegisterEventForKey("changePolarity", Keys.Z);
19
20 InputController.RegisterEventForButton("shoot", Buttons.X);
21 InputController.RegisterEventForKey("shoot", Keys.X);
22 }
23
24 public override void LoadContent()
25 {
26 Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
27
28 Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition));
29 Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200)));
30 Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200)));
31 }
32
33 public override void Update(GameTime gameTime)
34 {
35 InputController.UpdateInput();
36 ActorManager.Update(gameTime);
37 }
38
39 public override void Draw(SpriteBatch spriteBatch)
40 {
41 Renderer.Draw(spriteBatch);
42 }
43 }
44}